class BookingTests extends GroovyTestCase {

    void testCheckinDateValidation() {
        Booking booking = new Booking(checkinDate: new Date() - 1)
        assertFalse booking.validate()
        assertNotNull booking.errors.getFieldError('checkinDate').codes.find {it == 'booking.checkinDate.validator.error'}

        booking.checkinDate = null
        assertFalse booking.validate()
        assertNotNull booking.errors.getFieldError('checkinDate').codes.find {it == 'booking.checkinDate.nullable.error'}
    }
}
